<?php

namespace App\Models;

use Attribute;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Foundation\Auth\User as Authenticatable;



class AdminUser extends Authenticatable
{
    use HasFactory;
    // 引入软删除
    use SoftDeletes;
    // 定义白名单，允许用户进行更新的字段
    protected $fillable = ["username","password","state"];
    const NORMAL = 1; //正常可登录
    const BAN = 0; //禁用不可登录

    // 使用传统闭包方式
    public function getStateTextAttribute(){
        return config('project.admin.state')[$this->state];
    }
}
